package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.check.inspectionplan;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.check.inspectionplan.InspectionPlanService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * 检查计划控制器
 */
@Action
@RequestMapping(value="check/inspectionPlan")
public class InspectionPlanController extends BaseController {
    @Resource
    public InspectionPlanService inspectionPlanService;

    /**
     * 检查计划添加
     * @param
     * brief	计划概要
     * checkCycle	检查周期
     * starttime	检查时间:一天开始时间
     * endtime	检查时间：一天结束时间
     * startdate	检查日期:开始日期
     * enddate	检查日期：结束日期
     * nocheckWeekday	不检查日期
     * checkPersonId	检查人员
     * taskId	检查任务
     * taskName	任务名称
     * addrs	很多巡检点id的字符串，巡检点id之间逗号分隔
     * @return
     */
    @At(value = "inspectionPlanAdd", method = RequestMethod.POST, param = {"addrs"})
    public RespEntity inspectionPlanAdd(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionPlanService.inspectionPlanAdd(jsonParam);
    }

    /**
     * 检查计划列表
     * @param
     * page	第几页
     * startdate	检查开始日期
     * enddate	检查结束日期
     * businessId	单位id：如果是机构用户登录需要传,如果是单位用户自己取
     * limit	每页多少条
     * rfid	RFID码
     * @return
     */
    @At(value = "inspectionPlanListPage", method = RequestMethod.GET, param = { "page","limit"})
    public RespEntity inspectionPlanListPage(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionPlanService.inspectionPlanListPage(jsonParam);
    }

    /**
     * 检查计划详情
     * @param  id	检查计划的id
     * @return
     */
    @At(value = "inspectionPlanDetail", method = RequestMethod.GET, param = { "id"})
    public RespEntity inspectionPlanDetail(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionPlanService.inspectionPlanDetail(jsonParam);
    }

    /**
     * 检查计划列表(app)
     * @param  page    第几页	是
     * businessId	单位id：如果是机构用户登录需要传,如果是单位用户自己取	否
     * limit	每页多少条	是
     * @return
     */
    @At(value = "inspectionPlanForAppListPage", method = RequestMethod.GET, param = { "page","limit"})
    public RespEntity inspectionPlanForAppListPage(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionPlanService.inspectionPlanForAppListPage(jsonParam);
    }

    /**
     * 判断今天是否还可以巡检(app)
     * @param  id	检查计划的id
     * @return
     */
    @At(value = "canCheckOrNo", method = RequestMethod.GET, param = { "id"})
    public RespEntity canCheckOrNo(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionPlanService.canCheckOrNo(jsonParam);
    }

    /**
     * 计划巡检点列表(app)
     * @param  page    第几页
     * planId	计划id
     * limit	每页多少条
     * @return
     */
    @At(value = "checkaddrForAppListPage", method = RequestMethod.GET, param = { "planId","page","limit"})
    public RespEntity checkaddrForAppListPage(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionPlanService.checkaddrForAppListPage(jsonParam);
    }

    /**
     * 检查计划详情
     * @param  id    巡检点的id
     * @return
     */
    @At(value = "inspectionForAppPlanDetail", method = RequestMethod.GET)
    public RespEntity inspectionForAppPlanDetail(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionPlanService.inspectionForAppPlanDetail(jsonParam);
    }

    /**
     * 检查计划删除
     * @param  id    计划的id
     * @return
     */
    @At(value = "inspectionPlanDelete", method = RequestMethod.POST, param = { "id"})
    public RespEntity inspectionPlanDelete(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionPlanService.inspectionPlanDelete(jsonParam);
    }
   
}